package com.jytc.framework.po;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * FwRole entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "fw_role")
public class FwRole implements java.io.Serializable {

	// Fields

	private Integer roleId;
	private String roleName;
	private String roleDesc;
	private Integer deptId;
	private Integer systemType;
	private Integer status;
	private Set<FwUserRole> fwUserRoles = new HashSet<FwUserRole>(0);
	private Set<FwRolePermission> fwRolePermissions = new HashSet<FwRolePermission>(
			0);

	// Constructors

	/** default constructor */
	public FwRole() {
	}
	
	public FwRole(Integer roleId) {
		this.roleId = roleId;
	}

	/** minimal constructor */
	public FwRole(String roleName, Integer deptId, Integer systemType,
			Integer status) {
		this.roleName = roleName;
		this.deptId = deptId;
		this.systemType = systemType;
		this.status = status;
	}

	/** full constructor */
	public FwRole(String roleName, String roleDesc, Integer deptId,
			Integer systemType, Integer status, Set<FwUserRole> fwUserRoles,
			Set<FwRolePermission> fwRolePermissions) {
		this.roleName = roleName;
		this.roleDesc = roleDesc;
		this.deptId = deptId;
		this.systemType = systemType;
		this.status = status;
		this.fwUserRoles = fwUserRoles;
		this.fwRolePermissions = fwRolePermissions;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "role_id", unique = true, nullable = false)
	public Integer getRoleId() {
		return this.roleId;
	}

	public void setRoleId(Integer roleId) {
		this.roleId = roleId;
	}

	@Column(name = "role_name", nullable = false, length = 50)
	public String getRoleName() {
		return this.roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	@Column(name = "role_desc", length = 200)
	public String getRoleDesc() {
		return this.roleDesc;
	}

	public void setRoleDesc(String roleDesc) {
		this.roleDesc = roleDesc;
	}

	@Column(name = "dept_id", nullable = false)
	public Integer getDeptId() {
		return this.deptId;
	}

	public void setDeptId(Integer deptId) {
		this.deptId = deptId;
	}

	@Column(name = "system_type", nullable = false)
	public Integer getSystemType() {
		return this.systemType;
	}

	public void setSystemType(Integer systemType) {
		this.systemType = systemType;
	}

	@Column(name = "status", nullable = false)
	public Integer getStatus() {
		return this.status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "fwRole")
	public Set<FwUserRole> getFwUserRoles() {
		return this.fwUserRoles;
	}

	public void setFwUserRoles(Set<FwUserRole> fwUserRoles) {
		this.fwUserRoles = fwUserRoles;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "fwRole")
	public Set<FwRolePermission> getFwRolePermissions() {
		return this.fwRolePermissions;
	}

	public void setFwRolePermissions(Set<FwRolePermission> fwRolePermissions) {
		this.fwRolePermissions = fwRolePermissions;
	}

}